package com.zmovie.front.util;

import java.util.Calendar;
import java.util.Date;

/**
 * @author 挚爱之夕
 * @version 1.0
 * @implSpec 日期相关
 * @since 2023-12-16 16:46
 */
public class DateUtil {
    private static final Calendar nowCalendar = Calendar.getInstance();

    public static boolean beforeNow(Date date){
        Calendar calendar = new Calendar.Builder().setInstant(date).build();
        return calendar.before(nowCalendar);
    }
    public static boolean afterNow(Date date){
        Calendar calendar = new Calendar.Builder().setInstant(date).build();
        return calendar.after(nowCalendar);
    }
    public static Date addMonth(Date date, Integer amount){
        Calendar calendar = new Calendar.Builder().setInstant(date).build();
        calendar.add(Calendar.MONTH, amount);
        return calendar.getTime();
    }
}
